import { Axios, base, req } from './axiosFun';
// import qs from 'qs';

// 课件首页列表
function courseware( params = {}) {
  return Axios({
    url: `${base}/courseware/list`,
    method: "GET",
    params //传入进来的参数
  })
};

// 课件详情
function detailsList(params){
  return Axios({
    url: `${base}/courseware/detail`,
    method: 'GET',
    params
  })
}

// 课件新增
function newCourseware(data){
  return Axios({
    url: `${base}/courseware/save`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 课件操作中的上下架
function upAndDown(data) {
  return Axios({
    url: `${base}/courseware/jia`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}

// 课件中的右上角 上架
function topShelves(params) {
  return Axios({
    url: `${base}/courseware/Shangjia`,
    method: 'GET',
    params
  })
}

// 课件中的右上角 下架
function botShelves(params) {
  return Axios({
    url: `${base}/courseware/Xiajia`,
    method: 'GET',
    params
  })
}

// 课件删除
function deleteList(params) {
  return Axios({
    url: `${base}/courseware/delete`,
    method: 'GET',
    params
  })
}

// 列表页右上角删除
function deleteListAll(params) {
  return Axios({
    url: `${base}/courseware/deleteAll`,
    method: 'GET',
    params
  })
}

// 课件图片上传
function uploadImge(params){
  return Axios({
    url: `${base}/courseware/wareimg`,
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    },
    params
  })
}

// 课件文件上传
function fileUpload( params ) {
  return Axios({
    url: `${base}/courseware/warejian`,
    method: 'GET',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    params
  })
}

// 课件列表详情中安装设备卸载操作
function uninstallList( params ) {
  return Axios({
    url: `${base}/courseware/deleteShe`,
    method: 'GET',
    params
  })
}

// 课件列表详情编辑接口
function findBYidEcho( params ) {
  return Axios({
    url: `${base}/courseware/findBYid`,
    method: 'GET',
    params
  })
}

// 课件列表全部分类和新增、修改中的全部分类
function allCategories( params ) {
  return Axios({
    url: `${base}/courseware/listClassify`,
    method: 'GET',
    params
  })
}

// 课件排序请求数组
function questSort( params ) {
  return Axios({
    url: `${base}/courseware/listSort`,
    method: 'GET',
    params
  })
}

// 课件排序请求保存接口
function sortingSave(data) {
  return Axios({
    url: `${base}/courseware/updateSort`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}


// 导出
export default {
  courseware,
  detailsList,
  upAndDown,
  deleteList,
  deleteListAll,
  uploadImge,
  newCourseware,
  fileUpload,
  topShelves,
  botShelves,
  uninstallList,
  findBYidEcho,
  allCategories,
  questSort,
  sortingSave,

}
